package com.movie2.model.vo;

import com.movie2.model.DTO.Test11Dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Description:
 *
 * @author 项浩楠
 * @since 9:35 2022/10/17
 */
@Data
@Slf4j
@AllArgsConstructor
@NoArgsConstructor
public class Test11Vo implements Serializable {
    private Test11Dto one;
    
    private Test11Dto two;
    
    private Test11Dto three;
    
    private Test11Dto four;
    
    private Test11Dto five;
    
    
    
    public void setByName(String str,Test11Dto dto) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Field[] fields=this.getClass().getDeclaredFields();
        for (Field field : fields) {
            log.info("name:{}",field.getName());
            if (field.getName().equals(str)){
                field.set(this.getClass(),dto);
                break;
            }
        }
    }
}
